﻿using System;
using System.Runtime.InteropServices;

namespace Vtron.HipcConfigurationTools.Domain
{
    /// <summary>
    /// 解码端连接编码端视频的应答
    /// </summary>
    /// <remarks>
    /// typedef  struct
    ///{
    ///    T_HIPC_NET_HEADER	   head;
    ///     Uint8  channel;          //
    ///     Uint8  ipAddress[20];   //mode为组播，则为组播地址 否则为client的ip地址
    ///     Uint16  port;            //端口号   
    ///     Uint8  mode;            //视频发送方式 0:UDP组播 1:UDP 2:TCP 3:RTP.
    /// } T_HIPC_VIDEO_CONNECT_RESP;
    /// </remarks>
    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct T_HIPC_VIDEO_CONNECT_RESP
    {
        #region Fields

        /// <summary>
        /// 网络协议数据头
        /// </summary>
        public T_HIPC_NET_HEADER head;

        /// <summary>
        /// 通道号
        /// </summary>
        public byte channel;

        /// <summary>
        /// ip地址
        /// </summary>
        /// <remarks>
        /// mode为组播，则为组播地址 否则为client的ip地址
        /// </remarks>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
        public byte[] ipAddress;

        /// <summary>
        /// 端口号
        /// </summary>
        public Int16 port;

        /// <summary>
        /// 视频发送方式
        /// </summary>
        /// <remarks>
        /// 0:UDP组播 1:UDP 2:TCP 3:RTP
        /// </remarks>
        public byte mode;

        #endregion
    }
}
